export default class SessionManager {
    _sessionKey: string = "";
    get sessionKey() {
      return this._sessionKey;
    }
  
    isCurrentSession(key: string): boolean {
      return this._sessionKey === key;
    }
  
    newSession(): boolean {
      this.cancelSession(this.sessionKey);
      this._sessionKey = String(Date.now());
      return true;
    }
    cancelSession(key: string) {
      if (this.isCurrentSession(key)) {
        this._sessionKey = "";
        return true;
      }
      return false;
    }
  
    clearSession(): string {
      this._sessionKey = "";
      return this._sessionKey;
    }
  }